package com.dayfly.tip.dao.impl;

import java.util.HashMap;
import java.util.Map;

import com.dayfly.tip.dao.BaseDAO;
import com.dayfly.tip.dao.UserDAO;
import com.dayfly.tip.model.UserDO;
import com.dayfly.tip.util.IdGenerator;

public class UserDAOImpl extends BaseDAO implements UserDAO {

	@Override
	public UserDO getUser(String userName, String password) {
		Map<String,String> map = new HashMap<String, String>();
		map.put("userName", userName);
		map.put("password", password);
		return (UserDO) this.getSqlMapClientTemplate().queryForObject("getUserByCheck", map);
	}

	@Override
	public void createUser(UserDO user) {
		user.setUserId(IdGenerator.getUserId());
		this.getSqlMapClientTemplate().insert("createUser",user);
	}

}
